import { IPSAppDEAction } from '../dataentity/ipsapp-deaction';
import { IPSAppDEField } from '../dataentity/ipsapp-defield';
import { IPSAppDataEntity } from '../dataentity/ipsapp-data-entity';
import { IPSAppDynaUtilBase } from './ipsapp-dyna-util-base';
import { PSAppUtilImpl } from './psapp-util-impl';

export class PSAppDynaUtilImplBase extends PSAppUtilImpl implements IPSAppDynaUtilBase {
  protected appidpsappdefield: IPSAppDEField | null = null;

  getAppIdPSAppDEField(): IPSAppDEField | null {
    if (this.appidpsappdefield != null) return this.appidpsappdefield;
    const value = this.M.getAppIdPSAppDEField;
    if (value == null) {
      return null;
    }
    this.appidpsappdefield = this.getStoragePSAppDataEntityMust().findPSAppDEField(value);
    return this.appidpsappdefield;
  }

  get appIdPSAppDEField(): IPSAppDEField | null {
    return this.getAppIdPSAppDEField();
  }

  getAppIdPSAppDEFieldMust(): IPSAppDEField {
    const value = this.getAppIdPSAppDEField();
    if (value == null) {
      throw new Error('未指定应用标识存储属性');
    }
    return value;
  }

  protected createpsappdeaction: IPSAppDEAction | null = null;

  getCreatePSAppDEAction(): IPSAppDEAction | null {
    if (this.createpsappdeaction != null) return this.createpsappdeaction;
    const value = this.M.getCreatePSAppDEAction;
    if (value == null) {
      return null;
    }
    this.createpsappdeaction = this.getStoragePSAppDataEntityMust().findPSAppDEAction(value);
    return this.createpsappdeaction;
  }

  get createPSAppDEAction(): IPSAppDEAction | null {
    return this.getCreatePSAppDEAction();
  }

  getCreatePSAppDEActionMust(): IPSAppDEAction {
    const value = this.getCreatePSAppDEAction();
    if (value == null) {
      throw new Error('未指定建立数据行为');
    }
    return value;
  }

  protected getpsappdeaction: IPSAppDEAction | null = null;

  getGetPSAppDEAction(): IPSAppDEAction | null {
    if (this.getpsappdeaction != null) return this.getpsappdeaction;
    const value = this.M.getGetPSAppDEAction;
    if (value == null) {
      return null;
    }
    this.getpsappdeaction = this.getStoragePSAppDataEntityMust().findPSAppDEAction(value);
    return this.getpsappdeaction;
  }

  get getPSAppDEAction(): IPSAppDEAction | null {
    return this.getGetPSAppDEAction();
  }

  getGetPSAppDEActionMust(): IPSAppDEAction {
    const value = this.getGetPSAppDEAction();
    if (value == null) {
      throw new Error('未指定获取数据行为');
    }
    return value;
  }

  protected modelidpsappdefield: IPSAppDEField | null = null;

  getModelIdPSAppDEField(): IPSAppDEField | null {
    if (this.modelidpsappdefield != null) return this.modelidpsappdefield;
    const value = this.M.getModelIdPSAppDEField;
    if (value == null) {
      return null;
    }
    this.modelidpsappdefield = this.getStoragePSAppDataEntityMust().findPSAppDEField(value);
    return this.modelidpsappdefield;
  }

  get modelIdPSAppDEField(): IPSAppDEField | null {
    return this.getModelIdPSAppDEField();
  }

  getModelIdPSAppDEFieldMust(): IPSAppDEField {
    const value = this.getModelIdPSAppDEField();
    if (value == null) {
      throw new Error('未指定模型标识存储属性');
    }
    return value;
  }

  protected modelpsappdefield: IPSAppDEField | null = null;

  getModelPSAppDEField(): IPSAppDEField | null {
    if (this.modelpsappdefield != null) return this.modelpsappdefield;
    const value = this.M.getModelPSAppDEField;
    if (value == null) {
      return null;
    }
    this.modelpsappdefield = this.getStoragePSAppDataEntityMust().findPSAppDEField(value);
    return this.modelpsappdefield;
  }

  get modelPSAppDEField(): IPSAppDEField | null {
    return this.getModelPSAppDEField();
  }

  getModelPSAppDEFieldMust(): IPSAppDEField {
    const value = this.getModelPSAppDEField();
    if (value == null) {
      throw new Error('未指定模型存储属性');
    }
    return value;
  }

  protected removepsappdeaction: IPSAppDEAction | null = null;

  getRemovePSAppDEAction(): IPSAppDEAction | null {
    if (this.removepsappdeaction != null) return this.removepsappdeaction;
    const value = this.M.getRemovePSAppDEAction;
    if (value == null) {
      return null;
    }
    this.removepsappdeaction = this.getStoragePSAppDataEntityMust().findPSAppDEAction(value);
    return this.removepsappdeaction;
  }

  get removePSAppDEAction(): IPSAppDEAction | null {
    return this.getRemovePSAppDEAction();
  }

  getRemovePSAppDEActionMust(): IPSAppDEAction {
    const value = this.getRemovePSAppDEAction();
    if (value == null) {
      throw new Error('未指定删除数据行为');
    }
    return value;
  }

  protected stoagepsappdataentity: IPSAppDataEntity | null = null;

  getStoagePSAppDataEntity(): IPSAppDataEntity | null {
    if (this.stoagepsappdataentity != null) return this.stoagepsappdataentity;
    const value = this.M.getStoagePSAppDataEntity;
    if (value == null) {
      return null;
    }
    this.stoagepsappdataentity = this.getPSModel4('app.dataentity.IPSAppDataEntity', value, 'getStoagePSAppDataEntity') as IPSAppDataEntity;
    return this.stoagepsappdataentity;
  }

  get stoagePSAppDataEntity(): IPSAppDataEntity | null {
    return this.getStoagePSAppDataEntity();
  }

  getStoagePSAppDataEntityMust(): IPSAppDataEntity {
    const value = this.getStoagePSAppDataEntity();
    if (value == null) {
      throw new Error('未指定功能数据存储实体');
    }
    return value;
  }

  protected storagepsappdataentity: IPSAppDataEntity | null = null;

  getStoragePSAppDataEntity(): IPSAppDataEntity | null {
    if (this.storagepsappdataentity != null) return this.storagepsappdataentity;
    const value = this.M.getStoragePSAppDataEntity;
    if (value == null) {
      return null;
    }
    this.storagepsappdataentity = this.getPSModel4('app.dataentity.IPSAppDataEntity', value, 'getStoragePSAppDataEntity') as IPSAppDataEntity;
    return this.storagepsappdataentity;
  }

  get storagePSAppDataEntity(): IPSAppDataEntity | null {
    return this.getStoragePSAppDataEntity();
  }

  getStoragePSAppDataEntityMust(): IPSAppDataEntity {
    const value = this.getStoragePSAppDataEntity();
    if (value == null) {
      throw new Error('未指定功能数据存储实体');
    }
    return value;
  }

  protected updatepsappdeaction: IPSAppDEAction | null = null;

  getUpdatePSAppDEAction(): IPSAppDEAction | null {
    if (this.updatepsappdeaction != null) return this.updatepsappdeaction;
    const value = this.M.getUpdatePSAppDEAction;
    if (value == null) {
      return null;
    }
    this.updatepsappdeaction = this.getStoragePSAppDataEntityMust().findPSAppDEAction(value);
    return this.updatepsappdeaction;
  }

  get updatePSAppDEAction(): IPSAppDEAction | null {
    return this.getUpdatePSAppDEAction();
  }

  getUpdatePSAppDEActionMust(): IPSAppDEAction {
    const value = this.getUpdatePSAppDEAction();
    if (value == null) {
      throw new Error('未指定更新数据行为');
    }
    return value;
  }

  protected useridpsappdefield: IPSAppDEField | null = null;

  getUserIdPSAppDEField(): IPSAppDEField | null {
    if (this.useridpsappdefield != null) return this.useridpsappdefield;
    const value = this.M.getUserIdPSAppDEField;
    if (value == null) {
      return null;
    }
    this.useridpsappdefield = this.getStoragePSAppDataEntityMust().findPSAppDEField(value);
    return this.useridpsappdefield;
  }

  get userIdPSAppDEField(): IPSAppDEField | null {
    return this.getUserIdPSAppDEField();
  }

  getUserIdPSAppDEFieldMust(): IPSAppDEField {
    const value = this.getUserIdPSAppDEField();
    if (value == null) {
      throw new Error('未指定用户标识存储属性');
    }
    return value;
  }

  get cls(): string {
    return 'PSAppDynaUtilImplBase';
  }

  instanceof(cls: string): boolean {
    if (cls == 'app.util.IPSAppDynaUtilBase') return true;
    return super.instanceof(cls);
  }
}
